<div class="container">
      <div class="card">
        <div class="card-body">
          <h5 class="card-title"><small><a href="https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html#5" target="_blank">模板消息</a></small></h5>
          <p class="text-danger">http请求方式: POST https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN</p>
          <div class="mt-4">
            <button type="button" id="POST_TEMPLATE_MSG_BUTTON" class="btn btn-primary">发送默认模板消息</button>
        </div>
        </div>
      </div>
    </div>
</div>
    
<script>
    $(function(){
        $("#POST_TEMPLATE_MSG_BUTTON").on("click", function(){
            var openid = '{{.OpenID}}';
            $.post("/wx/send_template_message", { openid: openid }, function(json){
                if(json.flag){
                    alert(json.msg);
                }else{                    
                    alert(json.msg);
                }
            })
        });
    });
</script>